package org.lc.eic.messageconstruct.jaxb.content;

import java.util.HashMap;
import java.util.Map;

import org.lc.eic.messageconstruct.jaxb.content.string.StringContentCoder;

public class ContentMapper {
	
	private Map<String, ContentEncoder> encoderMap = new HashMap<String, ContentEncoder>();
	private Map<String, ContentDecoder> decoderMap = new HashMap<String, ContentDecoder>();
	

	
	

	public ContentMapper(){
		addContentEncoder(new StringContentCoder());
		addContentDecoder(new StringContentCoder());
	}
	
	public void addContentDecoder(ContentDecoder contentDecoder){		
		decoderMap.put(contentDecoder.getDecodeContentType(), contentDecoder);
	}
	
	public void addContentEncoder(ContentEncoder contentEncoder){
		encoderMap.put(contentEncoder.getEncodeContentType(), contentEncoder);		
	}

	public ContentDecoder getContentDecoder(String contentType) {
		return decoderMap.get(contentType);
	
	}

	public ContentEncoder getContentEncoder(String contentType) {
		return encoderMap.get(contentType);
	}

}
